<?php
namespace App\Traits;

use Session;

trait SessionTrait
{

    public function sessionSysBaseInfo($data)
    {
        Session::put('company_id', $data['company_id']);
        Session::put('account_phone', $data['account_info']['user_phone']);
        Session::put('company_type', $data['company_type']);
        Session::put('account_info', $data['account_info']);
    }

    public function sessionUserLogin($data)
    {
        $this->sessionSysBaseInfo($data);
    }

    public function sessionUserLogout($data)
    {
        Session::forget('company_id');
        //Session::forget('company_name');
        Session::forget('account_phone');
        Session::forget('company_type');
        //Session::forget('user_token');
        Session::forget('account_info');
        Session::forget('user_could_edit_company_info_from_front');
    }

    /**
     * sessionUserCouldEditCompanyInfoFromFront
     * 用户前台录入公司数据信息
     * @param  [type] $data [description]
     * @return [type]       [description]
     */
    public function sessionUserCECIFF()
    {
        Session::put('user_could_edit_company_info_from_front', true);
    }

    public function sessionReturnUserCECIFF()
    {
        return Session::get('user_could_edit_company_info_from_front');
    }

    public function sessionReturnUserPhone()
    {
        return Session::get('account_phone');
    }

    public function sessionReturnUserAccountInfo()
    {
        return Session::get('account_info');
    }

    public function sessionReturnCompanyId()
    {
        return Session::get('company_id');
    }
}
